package org.redis.cluster.util;

import java.io.InputStream;

import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.io.SAXReader;

public class XmlUtil {
	
	private final static String DEFAULT_ENCODING="UTF-8";
	
	/**
	 * 读
	 * @param input
	 * @param encoding
	 * @return
	 * @throws DocumentException 
	 */
	public static Document read(InputStream input,String encoding) throws DocumentException {
		SAXReader reader=new SAXReader();
		return reader.read(input,encoding);
	}
	
	/**
	 * 读
	 * @param input
	 * @return
	 * @throws DocumentException 
	 */
	public static Document read(InputStream input) throws DocumentException {
		return read(input, DEFAULT_ENCODING);
	}
}